home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_riv_lockerpatches.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  235 lines

  1. # Jones 3D Cog Script
  2. #
  3. # RIV_LockerPatches.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     activated
  15.  
  16.     thing       player      local
  17.     thing       door
  18.     thing       offsetCam
  19.     thing       cam1
  20.     thing       camTarg
  21.     thing       ghostPos        # move player to this pos
  22.     
  23.     surface     surf_Patches    mask=0x400
  24.     
  25.     sound       snd_Open=fol_lockr_opn.wav          local
  26.     sound       snd_Close=fol_lockr_cls.wav         local
  27.     
  28.     # ** voice lines **
  29.     sound       say_DontNeed=inxj234.wav            local
  30.     sound       say_RaftKit=inxj241.wav             local
  31.     
  32.     cog         talkCog     local
  33.     
  34.     # ** subroutines **
  35.     flex        openDoor    local
  36.     flex        closeDoor   local
  37.     flex        getAPatch   local
  38.     
  39.     int         open=0      local
  40.     int         playing=0   local
  41.  
  42. end
  43.  
  44. # ========================================================================================
  45.  
  46. code
  47.  
  48. startup:
  49.  
  50.     SetThingLight(door, '0.25 0.25 0.25', 0.1, 0.5);
  51.     return;
  52.     
  53. # ========================================================================================
  54.  
  55. activated:
  56.  
  57.     player = GetLocalPlayerThing();
  58.  
  59.     if((GetSenderRef() == door) && (open == 0) && (playing == 0))
  60.     {
  61.         # player activated with lighter
  62.         if(GetCurWeapon(player) == 13)
  63.         {
  64.             playing = 1;
  65.             DeselectWeaponWait(player);
  66.             Call openDoor;
  67.         }
  68.         
  69.         # normal activation
  70.         else
  71.         {
  72.             playing = 1;
  73.             DeselectWeaponWait(player);
  74.             Call openDoor;
  75.         }
  76.     }
  77.     
  78.     else if((GetSenderRef() == surf_Patches) && (open == 1) && (playing == 0))
  79.     {
  80.         playing = 1;
  81.         DeselectWeaponWait(player);
  82.         Call GetAPatch;
  83.     }
  84.     
  85.     #else if((GetSenderRef() == door) && (open == 1) && (playing == 0))
  86.     #{
  87.     #    # player activated with lighter
  88.     #    if(GetCurWeapon(player) == 13)
  89.     #    {
  90.     #        playing = 1;
  91.     #        open = 0;
  92.     #        
  93.     #        # put away the lighter
  94.     #        DeselectWeapon(player);
  95.     #        DeselectWeaponWait(player);
  96.     #        
  97.     #        Call closeDoor;
  98.     #    }
  99.     #    
  100.     #    # normal activation
  101.     #    else
  102.     #    {
  103.     #        playing = 1;
  104.     #        open = 0;
  105.     #        
  106.     #        # wait for weapon to be put away
  107.     #        DeselectWeaponWait(player);
  108.     #        
  109.     #        Call closeDoor;
  110.     #    }
  111.     #}
  112.     
  113.     return;
  114.     
  115. # ========================================================================================
  116.  
  117. openDoor:
  118.  
  119.     # do cutscene stuff
  120.     MakeMeStop();
  121.     StartCutscene(0);
  122.     
  123.     # offset camera and nudge door
  124.     #SetExtCamOffsetToThing(offsetCam);
  125.     PlayMode(player, 60, 0);
  126.     Sleep(0.3);
  127.     
  128.     Sleep(0.5);
  129.     
  130.     # switch to camera inside locker
  131.     SetCameraFocus(2, cam1);
  132.     SetCameraSecondaryFocus(2, camTarg);
  133.     SetCurrentCamera(2);
  134.     
  135.     # move player away from door
  136.     CopyOrientAndPos(ghostPos, player);
  137.     
  138.     Sleep(0.5);
  139.     
  140.     # open the door
  141.     PlaySoundLocal(snd_Open, 1.0, 0.0, 0x0, 0);
  142.     Rotate(door, -90, 1, 1.0);
  143.     WaitForStop(door);
  144.     
  145.     Sleep(0.5);
  146.     
  147.     # restore curCam
  148.     SetCameraPosition(1, GetThingPos(offsetCam));
  149.     SetCurrentCamera(1);
  150.     
  151.     RestoreExtCam();
  152.     
  153.     # return control to player
  154.     ClearActorFlags(player, 0x200000);
  155.     EndCutscene();
  156.     
  157.     playing = 0;
  158.     open = 1;
  159.     
  160.     return;
  161.     
  162. # ========================================================================================
  163.  
  164. closeDoor:
  165.  
  166.     playing = 1;
  167.     PlaySoundLocal(snd_Close, 1.0, 0.0, 0x0, 0);
  168.     Rotate(door, 90, 1, 1.0);
  169.     WaitForStop(door);
  170.     playing = 0;
  171.     
  172.     return;
  173.     
  174. # ========================================================================================
  175.  
  176. getAPatch:
  177.  
  178.     if(GetInv(player, 56) < 3)
  179.     {
  180.         # do cutscene stuff
  181.         MakeMeStop();
  182.         StartCutscene(0);
  183.         
  184.         # reach for it
  185.         PlayMode(player, 60, 0);
  186.         Sleep(0.3);
  187.         
  188.         # Call the Pickup Lines cog
  189.         talkCog = GetCogByIndex(0);
  190.         SendMessage(talkCog, 27);
  191.         
  192.         # add a patch kit inventory
  193.         ChangeInv(player, 56, 1.0);
  194.         SetInvAvailable(player, 56, 1);
  195.         SetInvDisabled(player, 56, 1);
  196.         JonesInvItemChanged(56);
  197.         
  198.         # sleep for a bit to wait for talkCog
  199.         Sleep(1.0);
  200.         
  201.         # play voice line
  202.         PlayVoice(player, say_RaftKit, 1.0, 1);
  203.         
  204.         # return control to player
  205.         ClearActorFlags(player, 0x200000);
  206.         EndCutscene();
  207.     }
  208.     
  209.     else
  210.     {
  211.         # do cutscene stuff
  212.         MakeMeStop();
  213.         StartCutscene(0);
  214.         
  215.         # reach for it
  216.         PlayMode(player, 60, 0);
  217.         Sleep(0.3);
  218.         
  219.         # say voice line
  220.         PlayVoice(player, say_DontNeed, 1.0, 1);
  221.         
  222.         # return control to player
  223.         ClearActorFlags(player, 0x200000);
  224.         EndCutscene();
  225.     }
  226.  
  227.     playing = 0;
  228.     
  229.     return;
  230.     
  231. # ========================================================================================
  232.  
  233. end
  234.  
  235.